Same fix for gtk_entry_real_insert_text
authorMatthias Clasen <matthiasc@src.gnome.org>
Sat, 28 Apr 2007 18:04:00 +0000 (18:04 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 28 Apr 2007 18:04:00 +0000 (18:04 +0000)
svn path=/trunk/; revision=17679

ChangeLog
gtk/gtkentry.c

index 785f47d86a05cce50e8ba519e13f898fda5c9ddb..c78af24354ac87c05d8e54764e63b793c87f5d14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,8 @@
 2007-04-28  Matthias Clasen  <mclasen@redhat.com>
 
-       * gtk/gtkentry.c (gtk_entry_grab_focus): Only call
-       g_object_get() when necessary.  (#373137, Morten Welinder,
-       patch by Xan Lopez)
+       * gtk/gtkentry.c (gtk_entry_grab_focus): 
+       (gtk_entry_real_insert_text): Only call g_object_get() 
+       when necessary.  (#373137, Morten Welinder, patch by Xan Lopez)
 
 2007-04-28  Matthias Clasen  <mclasen@redhat.com>
 
index 9935340785113c5af83502e829563c3d184c0ad9..f9744662abc85e3158a3af0381a66e83501cf133 100644 (file)
@@ -2432,7 +2432,6 @@ gtk_entry_real_insert_text (GtkEditable *editable,
   GtkEntry *entry = GTK_ENTRY (editable);
   gint index;
   gint n_chars;
-  guint password_hint_timeout;
 
   if (new_text_length < 0)
     new_text_length = strlen (new_text);
@@ -2502,28 +2501,32 @@ gtk_entry_real_insert_text (GtkEditable *editable,
   if (entry->selection_bound > *position)
     entry->selection_bound += n_chars;
 
-  g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)),
-                "gtk-entry-password-hint-timeout", &password_hint_timeout,
-                NULL);
-
-  if (password_hint_timeout > 0 && n_chars == 1 && !entry->visible &&
-      (new_text_length < PASSWORD_HINT_MAX))
+  if (n_chars == 1 && !entry->visible && (new_text_length < PASSWORD_HINT_MAX))
     {
-      GtkEntryPasswordHint *password_hint = g_object_get_qdata (G_OBJECT (entry),
-                                                                quark_password_hint);
+      guint password_hint_timeout;
+
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (entry)),
+                    "gtk-entry-password-hint-timeout", &password_hint_timeout,
+                    NULL);
 
-      if (! password_hint)
+      if (password_hint_timeout > 0)
         {
-          password_hint = g_new0 (GtkEntryPasswordHint, 1);
-          g_object_set_qdata_full (G_OBJECT (entry), quark_password_hint,
-                                   password_hint,
-                                   (GDestroyNotify) gtk_entry_password_hint_free);
-        }
+          GtkEntryPasswordHint *password_hint = g_object_get_qdata (G_OBJECT (entry),
+                                                                    quark_password_hint);
+
+          if (!password_hint)
+            {
+              password_hint = g_new0 (GtkEntryPasswordHint, 1);
+              g_object_set_qdata_full (G_OBJECT (entry), quark_password_hint,
+                                       password_hint,
+                                       (GDestroyNotify) gtk_entry_password_hint_free);
+            }
 
-      memset (&password_hint->password_hint, 0x0, PASSWORD_HINT_MAX);
-      password_hint->password_hint_length = new_text_length;
-      memcpy (&password_hint->password_hint, new_text, new_text_length);
-      password_hint->password_hint_position = *position + n_chars;
+          memset (&password_hint->password_hint, 0x0, PASSWORD_HINT_MAX);
+          password_hint->password_hint_length = new_text_length;
+          memcpy (&password_hint->password_hint, new_text, new_text_length);
+          password_hint->password_hint_position = *position + n_chars;
+       }
     }
   else
     {